Skip to content

fix(event proto): reject malformed internal protobuf instead of panicking - #26292

Open
bruceg wants to merge 7 commits into
masterfrom
bruceg/fallible-event-proto-decode
Open

fix(event proto): reject malformed internal protobuf instead of panicking#26292
bruceg wants to merge 7 commits into
masterfrom
bruceg/fallible-event-proto-decode

Conversation

@bruceg

@bruceg bruceg commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Decode Vector's native event protobuf through TryFrom so a missing oneof or NaN float drops the record with error telemetry rather than crashing the source, tap, or disk-buffer reader.

References

Vector configuration

N/A

How did you test this PR?

Unit tests included

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

Contributor Guidelines

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Before pushing, follow our pre-push guidance.
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.

…king

Decode Vector's native event protobuf through `TryFrom` so a missing `oneof` or
NaN float drops the record with error telemetry rather than crashing the source,
tap, or disk-buffer reader.
@bruceg
bruceg requested a review from a team as a code owner September 3, 2026 02:13
@bruceg bruceg added domain: buffers Anything related to Vector's memory/disk buffers sink: vector Anything `vector` sink related source: vector Anything `vector` source related type: bug A bug fix labels Sep 3, 2026
@github-actions github-actions Bot added domain: sources Anything related to the Vector's sources domain: sinks Anything related to the Vector's sinks domain: core Anything related to core crates i.e. vector-core, core-common, etc labels Sep 3, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T20:31:20.405635Z 879aa84 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b2ca337e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/vector-core/src/event/proto.rs Outdated
Comment thread src/sources/vector/mod.rs Outdated
Comment on lines +29 to +40
pub enum EventProtoError {
#[snafu(display(
"event protobuf was structurally valid but an event or metric variant was absent or unrecognized; this often indicates a version mismatch"
))]
UnrecognizedEventVariant,
#[snafu(display(
"event protobuf contained a NaN float, which cannot be represented in Vector's event model"
))]
NanFloat,
#[snafu(display("event protobuf contained an invalid timestamp"))]
InvalidTimestamp,
}

@pront pront Sep 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An event can have NaN and also invalid timestamp. These errors can be modeled more cleanly with something like:

DecodeError::InvalidEvent {
    source: EventProtoError,
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c175e01

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these conversion errors need to be public at all? The nested Log, Metric, metadata, and sketch conversions could be private functions returning a private error, with the existing DecodeError type exposed at the boundary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, except that the TryFrom for EventWrapper / EventArray cannot use a private Error type, so that results in a ton of churn (~300 lines). I can go ahead with it if you're agreeable to that.

@bruceg
bruceg requested review from pront and tessneau September 3, 2026 22:11
Comment thread src/internal_events/grpc.rs Outdated
Comment thread src/sources/vector/mod.rs Outdated
@bruceg
bruceg requested a review from tessneau September 8, 2026 22:52

@pront pront left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGMT, let's one new comment on the enum thread.

Comment on lines +29 to +40
pub enum EventProtoError {
#[snafu(display(
"event protobuf was structurally valid but an event or metric variant was absent or unrecognized; this often indicates a version mismatch"
))]
UnrecognizedEventVariant,
#[snafu(display(
"event protobuf contained a NaN float, which cannot be represented in Vector's event model"
))]
NanFloat,
#[snafu(display("event protobuf contained an invalid timestamp"))]
InvalidTimestamp,
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these conversion errors need to be public at all? The nested Log, Metric, metadata, and sketch conversions could be private functions returning a private error, with the existing DecodeError type exposed at the boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: buffers Anything related to Vector's memory/disk buffers domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: sinks Anything related to the Vector's sinks domain: sources Anything related to the Vector's sources sink: vector Anything `vector` sink related source: vector Anything `vector` source related type: bug A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants